<template>
	<view>
		<view class="" v-if="myasklist.length>0" >
			<uni-card :extra="item.title" :isFull="true" v-for="item in myasklist">
				<text class="uni-body">{{item.askquestion == null ? '未回复':item.askquestion}}</text>
			</uni-card>
		</view>
		<view class="" v-else>
			<uni-grid :column="1" :highlight="true" @change="change" class="bigenpty" borderColor="#f5f5f5">
				<uni-grid-item v-for="(item, index) in 1" :index="index" :key="index" class="enpty" >
					<view class="grid-item-box" style="background-color:#f5f5f5;">
						<image class="image" :src="img" mode=""></image>
						<text class="text">{{content}}</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>

<script>
	import $http from '../../common/api/request.js'
	import {mapState} from 'vuex'
	export default {
		data() {
			return {
				myasklist:[],
				img:"../../static/tabBar/d9a2ef1dd71bb61792cfba799845ed8.png",
				content:"哎呀,我的里面什么也没有"
			};
		},
		computed:{
			  ...mapState({
			  	userInfo: state => state.user.userInfo
			  }),
		},
		methods:{
			change(){
				this.img = "../../static/tabBar/err-no-list.716e40d2.png";
				this.content = "你别急,真没有"
			},
			//发起请求拿数据:
			sendgetdata(){
				$http.request({
					url:"/sendgetdata",
					method:"post",
					data:{
						UserID:this.userInfo.id,
					}
				}).then((res)=>{
					if(res.code===200){
						this.myasklist = res.data;
					}
					console.log(this.myasklist);
				}).catch((err)=>{
					console.log(err);
				})
			}
		},
		onLoad() {
			this.sendgetdata()
		}
	}
</script>

<style lang="scss">
.image {
		width: 225px;
		
	}

	.text {
		font-size: 14px;
		margin-top: 5px;
	}

	.example-body {
		/* #ifndef APP-NVUE */
		// display: block;
		/* #endif */
	}

	.grid-dynamic-box {
		margin-bottom: 15px;
	}

	.grid-item-box {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
		width: 100%;
	}
	.enpty{
		width: 100%;
		
	}
	.bigenpty{
		position: relative;
		top: 50%;
		left: 0;
		transform: translateY(50%);
		
	}
</style>
